<script setup lang='ts'>
  import { onMounted, reactive, ref } from 'vue';
  import { gamesApi } from "@/api/controller";
  import configForm from './configForm.vue';
  const configFormRef = ref()
  const action = reactive({
    list:[] as Array<any>
  })
  const handleForm = (row:any = {})=>{
    configFormRef.value.openDialog(row)
  }
  const getConfigInfo = async()=>{
    const res = await gamesApi.angerbirdGetConfig()
    action.list = res?.data || []
  }
  onMounted(()=>{
    getConfigInfo()
  })
</script>

<template>
  <div class="xm-content">
    <el-table
      class="xm-main xm-TableCenter"
      :data="action.list"
      border>
      <el-table-column min-width="120" prop="desc" label="配置名称" />
      <el-table-column min-width="120" prop="value" label="配置内容" />
      <el-table-column width="180" fixed=right label="操作">
        <template #default="scope">
          <el-button type="primary" @click="handleForm(scope.row)">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <configForm ref="configFormRef" @update-list="getConfigInfo" />
  </div>
</template>

<style lang='scss' scoped>
  
</style>